package vn.com.vega.music.view.adapter;

import vn.com.vega.chacha.v2.fragment.PlayerArtistInfoFragment;
import vn.com.vega.chacha.v2.fragment.PlayerViewLyricsFragment;
import vn.com.vega.chacha.v2.fragment.PlayerViewThumbFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class PlayerViewAdapter extends FragmentPagerAdapter {
	public static final int INDEX_ARTIST_INFO_VIEW 	= 0;
	public static final int INDEX_THUMB_VIEW	 	= 1;
	public static final int INDEX_LYRIC_VIEW 		= 2;
	private static final int TOTAL_VIEW 			= 3;
	
	public boolean haveLyric = true;

	public PlayerViewAdapter(FragmentManager fm) {
		super(fm);
		// TODO Auto-generated constructor stub
	}

	@Override
	public Fragment getItem(int arg0) {
		// TODO Auto-generated method stub
		Fragment fragment = new Fragment();
		switch (arg0) {
		case INDEX_ARTIST_INFO_VIEW:
			fragment = new PlayerArtistInfoFragment();
			break;
		case INDEX_THUMB_VIEW:
			fragment = new PlayerViewThumbFragment();
			break;
		case INDEX_LYRIC_VIEW:
			fragment = new PlayerViewLyricsFragment();
			break;
		default:
			break;
		}
		return fragment;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		if (haveLyric) {
			return TOTAL_VIEW;
		} else {
			return TOTAL_VIEW - 1;
		}
	}

}
